package com.xuxueli.api.exception;

/**
 * description:
 * <p>
 * Date: 2019-04-30
 * <p>
 * Time: 16:01
 *
 * @author zhangxin
 */
public class JobException extends RuntimeException{

    private String errCode;
    private String errMessage;

    public JobException(JobErrorCode errorCode) {
        super(errorCode.toString());

        this.errCode = errorCode.getCode();
        this.errMessage = errorCode.getMessage();
    }

    public JobException(JobErrorCode errorCode, String message) {
        super("[" + errorCode.name() + "]" + message);

        this.errCode = errorCode.getCode();
        this.errMessage = message;
    }

    public JobException(JobErrorCode errorCode, String message, Throwable cause) {
        super("[" + errorCode.name() + "]" + message, cause);

        this.errCode = errorCode.getCode();
        this.errMessage = message;
    }

    public String getErrCode() {
        return errCode;
    }

    public String getErrMessage() {
        return errMessage;
    }

}
